package org.jing.r18.game.venusblood.lagoon;

import org.jing.core.logger.JingLogger;
import org.jing.r18.game.venusblood.lagoon.dto.Title;

import java.util.List;
import java.util.Scanner;

/**
 * Description: <br>
 *
 * @author: bks <br>
 * @createDate: 2025-04-24 <br>
 */
public class AnalysisTitles {
    private static final JingLogger LOGGER = JingLogger.getLogger(AnalysisTitles.class);

    private AnalysisTitles() {
        List<Title> titles = VBLHelper.getAllTitles();
        LOGGER.info("载入完成, 请选择功能");
        ui(titles);
    }

    private void ui(List<Title> titles) {
        while (true) {
            LOGGER.info("{}:查询索引/{}:查询编号/{}:查询称号名/{}:查询技能编号/{}:查询技能名/{}:退出",
                VBLHelper.TITLE_FILTER_MODEL_INDEX,
                VBLHelper.TITLE_FILTER_MODEL_ID,
                VBLHelper.TITLE_FILTER_MODEL_NAME,
                VBLHelper.TITLE_FILTER_MODEL_SKILL_ID,
                VBLHelper.TITLE_FILTER_MODEL_SKILL_NAME,
                VBLHelper.TITLE_FILTER_MODEL_QUIT);
            Scanner scanner = new Scanner(System.in);
            if (scanner.hasNextLine()) {
                int model = scanner.nextInt();
                if (0 == model) return;
                LOGGER.info("请输入值");
                scanner = new Scanner(System.in);
                if (scanner.hasNextLine()) {
                    String value = scanner.nextLine();
                    List<Title> qryResult = VBLHelper.filterTitles(titles, model, value);
                    for (Title t$ : qryResult) {
                        LOGGER.info(t$.output());
                    }
                }
            }
        }
    }

    public static void main(String[] args) throws Exception {
        new AnalysisTitles();
    }
}
